<?php

use yii\widgets\ActiveForm;
use yii\widgets\LinkPager;
use common\helpers\Url;
use common\helpers\Html;

$this->title = '日志管理';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="col-sm-12" style="margin-top: 10px;">
                    <?php $form = ActiveForm::begin([
                        'action' => Url::to(['index']),
                        'method' => 'get',
                    ]); ?>

                    <div class="col-sm-3">
                        <div class="input-group">

                            <?= Html::textInput('keyword', $keyword, [
                                'class' => 'form-control',
                                'id' => 'test-input',
                                'placeholder' => '请输入要查询的用户名或手机号',
                            ]) ?>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <div class="input-group">
                            <?= Html::dropDownList('close_type', NULL, [
                                '资金转入'  => '资金转入',
                                '资金转出'  => '资金转出',
                                '订单开仓' => '订单开仓',
                                '订单平仓' => '订单平仓',
                                '订单爆仓' =>'订单爆仓',
                                '用户赠金'=>'用户赠金',
                                '撤单'=>'撤单',
                                '后台强制平仓'=>'后台强制平仓',
                            ], [
                                'options' => [$close_type => ['selected' => TRUE]],
                                'prompt'  => '请选择日志类型',
                                'class'   => 'form-control',
                            ]) ?>
                        </div>
                    </div>
                            <span class="input-group-btn"><button class="btn btn-white"><i
                                            class="fa fa-search"></i> 搜索</button></span>
                    <?php ActiveForm::end(); ?>

                </div>
            </div>
            <div class="box-body table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>用户名</th>
                        <th>日志类型</th>
                        <th>改变金额</th>
                        <th>原先余额</th>
                        <th>最新余额</th>
                        <th>详细描述</th>
                        <th>创建时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($models as $key=>$model){ ?>
                        <tr id = <?= $model->member_id; ?>>
                            <td><?= $key + 1; ?></td>
                            <td><?= $model->member->username; ?></td>
                            <td><?= $model->type; ?></td>
                            <td><?= $model->price; ?></td>
                            <td><?= $model->price_old; ?></td>
                            <td><?= $model->price_new; ?></td>
                            <td><?= $model->desc; ?></td>
                            <td><?= date('Y-m-d H:i:s',$model->created_at); ?></td>
                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </div>
            <div class="box-footer">
                <?= LinkPager::widget([
                    'pagination' => $pages
                ]);?>
            </div>
        </div>
    </div>
</div>